package com.tongtong.neo4j.service;

import com.tongtong.neo4j.entity.BaseNode;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Title: Myself
 * @Author zl
 * @Package com.tongtong.neo4j.service
 * @Date 2025/8/27 8:26
 * @description: Neo4j实现类
 */
@Service
public interface MyselfRepository extends Neo4jRepository<BaseNode,String> {

    @Query("MATCH (n:Node2) where n.name ='赵六' " +
            "match path = (n)-[*0..]->(node) " +
            "with node,nodes(path) as allNode " +
            "RETURN {id: node.id, name: node.name, pid: allNode[size(allNode)-2].id} as result")
    List<Map<String,Object>> queryAllData();
}
